﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Tools;

namespace Common.Exceptions
{
    public class BaseException : Exception
    {
        public string Code { get; protected set; }
        public string[] MessageArgs { get; set; }
        public string DefaultMessage { get; protected set; }

        public BaseException(string code)
            : base()
        {
            Code = code;
            DefaultMessage = ExceptionHelper.GetMessageByCode(Code);
        }

        public BaseException(string code, params string[] messageArgs)
            : this(code)
        {
            MessageArgs = messageArgs;
        }

        public BaseException(string code, string defaultMessage)
            : this(code)
        {
            DefaultMessage = defaultMessage;
            MessageArgs = null;
        }

        public BaseException(string code, string defaultMessage, params string[] messageArgs)
            : this(code)
        {
            DefaultMessage = defaultMessage;
            MessageArgs = messageArgs;
        }

    }
}
